import { Component } from '@angular/core';
import {NavController, NavParams } from 'ionic-angular';
import {HttpServies} from '../../providers/http-servies';
import 'rxjs/add/operator/toPromise';

@Component({
  selector: 'page-position',
  templateUrl: 'position.html',
  providers:[HttpServies]
})
export class PositionPage {
  // public depositDate:any

  // dataJson:any=[];
  userInfo = {
    'title': '',
    'jobinten': '',
    'pay': '',
    'requirement': '',
    'companyname': '',
    'years': '',
    'jobfield': '',
    'site': '',
    'mobile':'',
    'describe': '',


  }

  constructor(public navCtrl: NavController, public navParams: NavParams,private http:HttpServies) {

  }

  ddf() {
    var param = "title=" + this.userInfo.title
        + "&jobinten=" + this.userInfo.jobinten
        + "&pay=" + this.userInfo.pay
        + "&requirement=" + this.userInfo.requirement
        + "&companyname=" + this.userInfo.companyname
        + "&years=" + this.userInfo.years
        + "&jobfield=" + this.userInfo.jobfield
        + "&site=" + this.userInfo.site
        + "&mobile=" + this.userInfo.mobile
        + "&describe=" + this.userInfo.describe
        + "&fulltime=" + 1;
    this.http.httpPost('/Home/human/posits', param)
        .then(res => {
          if (res && res.code == 1) {
            this.http.showErro(res.msg);
            console.log(res.msg);
          }else {
              this.http.showErro(res.msg);
          }

        })

  }

    ddfs(){
        var param = "title=" + this.userInfo.title
            + "&jobinten=" + this.userInfo.jobinten
            + "&pay=" + this.userInfo.pay
            + "&requirement=" + this.userInfo.requirement
            + "&companyname=" + this.userInfo.companyname
            + "&years=" + this.userInfo.years
            + "&jobfield=" + this.userInfo.jobfield
            + "&site=" + this.userInfo.site
            + "&mobile=" + this.userInfo.mobile
            + "&describe=" + this.userInfo.describe
            + "&fulltime=" + 0;
        this.http.httpPost('/Home/human/posits', param)
            .then(res => {
                if (res && res.code == 1) {
                    this.http.showErro(res.msg);
                    console.log(res.msg);
                }else {
                    this.http.showErro(res.msg);
                }

            })

    }
}
